import Common from '../../common/common.js';
import BaseListItem from "./BaseListItem.js";
import BaseWin from "./BaseWin.js";

function BaseList() {
    this.element;
    this.items = new Array();
    this.initElement();
}

BaseList.prototype = {
    initElement:function(){
        this.element = Common.tool.createElement({label:"ul",props:{className:"userList"}});
    },
    clearItems:function(){
        this.element.innerHTML = "";
        this.items = new Array();
    },
    setItems:function(items){
        this.clearItems();
        this.pushItems(items);
     },
    getItems:function(){
        return this.items;
    },
    pushItem:function(item){
        this.items.push(item);
        this.element.appendChild(item.element);
    },
    pushItems:function(items){
        items.map((d)=>{
            this.items.push(d);
            this.element.appendChild(d.element);
        });
    },
    getElement:function(){
        return this.element;
    }
}

export default BaseList;
